from src import Preproduction as Pre

id, ch = Pre.load("results/hanzi_2_one_hot.data")
cnt = len(ch)
V = cnt

print("cnt = " + str(cnt))
print("V = " + str(V))

from src.EmbeddingGloVe import genX as genX
from src.EmbeddingGloVe import Glove as Glove

import numpy as np

glove = Glove(V, 256)
glove.load("results/embedding120.model")

c1 = "猫"
c2 = "幗"
c3 = "虎"

print(glove.eval(0))
print(glove.eval(1))
print(glove.eval(2))
print(ch[0])
print(ch[1])
print(ch[2])

print("Eval...")
i1 = glove.eval(id[c1])
i2 = glove.eval(id[c2])
i3 = glove.eval(id[c3])

d12 = i1 - i2
d23 = i2 - i3
d13 = i1 - i3

print("%s-%s：" % (c1, c2) + str((d12 * d12).sum().data))
print("%s-%s：" % (c2, c3) + str((d23 * d23).sum().data))
print("%s-%s：" % (c3, c1) + str((d13 * d13).sum().data))

print("------------------------------")
